<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
</head>

<body>
    <div id="app">
        <router-link to="/shopList">商品列表</router-link>
        <router-link to="/sportList">体育列表</router-link>
        <router-view></router-view>
    </div>
    <script src="./lib/vue_2.5.22.js"></script>
    <script src="./lib/vue-router_3.0.2.js"></script>
    <script>
        var ShopList = {
            template: `
                <div>
                    <h1>商品展示区</h1>
                </div>
            `,
        };
        var SportList = {
            template: `
                <div>
                    <h1>体育展示区</h1>
                    <router-link to="/sportList/tab1">篮球列表</router-link>
                    <router-link to="/sportList/tab2">排球列表</router-link>
                    <router-view></router-view>
                </div>
            `,
        };
        var Tab1 = {
            template: `
                <div>
                    <h2>篮球展示区</h2>
                </div>
            `,
        };
        var Tab2 = {
            template: `
                <div>
                    <h2>排球展示区</h2>
                </div>
            `,
        };
        var router = new VueRouter({
            routes: [{
                path: '/',
                redirect: '/shopList',
            }, {
                path: '/shopList',
                component: ShopList,
            }, {
                path: '/sportList',
                component: SportList,
                children: [{
                    path: 'tab1',
                    component: Tab1,
                }, {
                    path: 'tab2',
                    component: Tab2,
                }, ],
            }, ],
        });
        var vm = new Vue({
            el: '#app',
            data: {},
            router,
        });
    </script>
</body>

</html>